<?php 
  require '../tools.func.php';
  require  '../db.func.php';
  require 'head.php';
  $prefix=getprefix();
  $sql="SELECT a.id,b.username,a.created_at,a.price FROM {$prefix}order as a LEFT JOIN {$prefix}user as b  on  a.uid=b.id 

        ORDER BY a.created_at DESC ";
  $res=query($sql);

    

 ?>
          <div class="row">
            <div class="col-md-12">
              <div class="card">
                <div class="card-header card-header-primary">
                  <div class="row">
                    <div class="col-12">
                      <h4 class="card-title ">所有订单</h4>
                      <p class="card-category"> 所有订单列表</p>
                    </div>
                  </div>

                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table table-hover">
                      <thead class=" text-primary">
                      <th>
                        ID
                      </th>
                      <th>
                        下单用户
                      </th>
                      <th>
                        订单价格
                      </th>
                      <th>
                        下单时间
                      </th>
                      </thead>
                      <tbody>
                      <?php foreach ($res as $k): ?>
                      <tr>
                        <td>
                          <?php echo $k['id'];?>
                        </td>
                        <td>
                           <?php echo $k['username'];?>
                        </td>
                        <td>
                          <?php echo $k['price'];?>
                        </td>
                        <td>
                         <?php echo $k['created_at'];?>
                        </td>
                      </tr>
                    <?php endforeach; ?>
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div>
 <?php require 'foot.php'; ?>